﻿@model HtmlItem
@{
	Layout = null;
}
<div id="modal-url-page-info" class="modal fade" tabindex="-1">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header no-padding">
				<div class="table-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
						<span class="white">&times;</span>
					</button>
					HTML Item: @Model.Code
				</div>
			</div>

			<div class="modal-body">
				<form method="post" action="@Url.Action("EditHtmlItem", "FrontAdmin")">
					@Html.AntiForgeryToken()
					<input type="hidden" name="code" value="@Model.Code" />
					<input type="hidden" name="returnurl" value="@ViewBag.ReturnUrl"/>

					<table class="tb-urlpage">
						@foreach (var field in Model.ItemFields)
	  {
							<tr>
								<th style="width: 200px;">@field.FieldName</th>
								<td>

									@if (field.DataType == HtmlItemFieldTypes.HTML || field.DataType == HtmlItemFieldTypes.SCRIPT)
		 {
										<textarea style="width:450px; height:120px; border:solid 1px #eee;"  name="@field.FieldName">@field.DataValue</textarea>
		 }
		 else if (field.DataType == HtmlItemFieldTypes.IMAGE)
		 {
			 <input type="text" name="@field.FieldName" id="@field.FieldName" value="@field.GetDataValue()" />
			 @Html.Partial("FileManagerButton", @field.FieldName)
		 }
		 
		 else if (field.DataType == HtmlItemFieldTypes.AIRPORT)
		 {
			 @*<input type="text" name="@field.FieldName" value="@field.GetDataValue()" />*@
			 @Html.Partial("AirportPicker", null, new ViewDataDictionary(){{"name", field.FieldName}, {"value", field.GetDataValue()}})
		 }
		 else
		 {

										<input type="text" name="@field.FieldName" value="@field.GetDataValue()" />
		 }
								</td>
							</tr>
	  }

						<tr>
							<th></th>
							<td>
								<button type="submit" class="btn btn-info">Update</button>
							</td>
						</tr>

					</table>
				</form>
			</div>

		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>
